package gene.android.accountingpro.finals;

import gene.android.accountingpro.equations.AccountsReceivableTurnoverRatio;
import gene.android.accountingpro.equations.CurrentRatio;
import gene.android.accountingpro.equations.DebtToTotalAssetsRatio;
import gene.android.accountingpro.equations.DebtToTotalEquityRatio;
import gene.android.accountingpro.equations.EarningsPerShare;
import gene.android.accountingpro.equations.Equation;
import gene.android.accountingpro.equations.GrossProfitMarginRatio;
import gene.android.accountingpro.equations.InventoryTurnoverRatio;
import gene.android.accountingpro.equations.NetProfitOnSalesRatio;
import gene.android.accountingpro.equations.QuickRatio;
import gene.android.accountingpro.equations.ReturnOnAssetsRatio;
import gene.android.accountingpro.equations.ReturnOnEquityRatio;
import gene.android.accountingpro.equations.TimesInterestEarnedRatio;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class EquationNames {
	
	public static final String CURRENT_RATIO = "Current Ratio";
	public static final String QUICK_RATIO = "Quick Ratio";
	public static final String DEBT_TO_TOTAL_ASSETS_RATIO =  "Debt to Total Assets Ratio";
	public static final String DEBT_TO_TOTAL_EQUITY_RATIO = "Debt to Total Equity Ratio";
	public static final String TIMES_INTEREST_EARNED_RATIO = "Times Interest Earned Ratio";
	public static final String ACCOUNTS_RECEIVABLE_TURNOVER_RATIO = "Accounts Receivable Turnover Ratio";
	public static final String INVENTORY_TURNOVER_RATIO = "Inventory Turnover Ratio";
	public static final String NET_PROFIT_ON_SALES_RATIO =  "Net Profit on Sales Ratio";
	public static final String GROSS_PROFIT_MARGIN_RATIO = "Gross Profit Margin Ratio";
	public static final String RETURN_ON_ASSETS_RATIO = "Return on Assets Ratio";
	public static final String RETURN_ON_EQUITY_RATIO = "Return on Equity Ratio";
	public static final String EARNINGS_PER_SHARE = "Earnings per share";
	public static final String P_E = "P/E";
	public static final String DIVIDEND_RATE_YIELD = "Dividend Rate/Yield";
	public static final String DIVIDEND_PAYOUT_RATIO = "Dividend Payout Ratio";
	public static final String BOOK_VALUE = "Book Value";
	

	public static List<String> getAllEquationNames()
	{
		List<String> equationNames = new ArrayList<String>();
		
		equationNames.add(CURRENT_RATIO);
		equationNames.add(QUICK_RATIO);
		equationNames.add(DEBT_TO_TOTAL_ASSETS_RATIO);
		equationNames.add(DEBT_TO_TOTAL_EQUITY_RATIO);
		equationNames.add(TIMES_INTEREST_EARNED_RATIO);
		equationNames.add(ACCOUNTS_RECEIVABLE_TURNOVER_RATIO);
		equationNames.add(INVENTORY_TURNOVER_RATIO);
		equationNames.add(NET_PROFIT_ON_SALES_RATIO);
		equationNames.add(GROSS_PROFIT_MARGIN_RATIO);
		equationNames.add(RETURN_ON_ASSETS_RATIO);
		equationNames.add(RETURN_ON_EQUITY_RATIO);
		equationNames.add(EARNINGS_PER_SHARE);
		equationNames.add(P_E);
		equationNames.add(DIVIDEND_RATE_YIELD);
		equationNames.add(DIVIDEND_PAYOUT_RATIO);
		equationNames.add(BOOK_VALUE);
		
		return equationNames;
	}
	
	private static Map<String, Equation> getEquationMap()
	{
		Map<String, Equation> map = new HashMap<String, Equation>();
		map.put(CURRENT_RATIO, new CurrentRatio());
		map.put(QUICK_RATIO, new QuickRatio());
		map.put(DEBT_TO_TOTAL_ASSETS_RATIO, new DebtToTotalAssetsRatio());
		map.put(DEBT_TO_TOTAL_EQUITY_RATIO, new DebtToTotalEquityRatio());
		map.put(TIMES_INTEREST_EARNED_RATIO, new TimesInterestEarnedRatio());
		map.put(ACCOUNTS_RECEIVABLE_TURNOVER_RATIO, new AccountsReceivableTurnoverRatio());
		map.put(INVENTORY_TURNOVER_RATIO, new InventoryTurnoverRatio());
		map.put(NET_PROFIT_ON_SALES_RATIO, new NetProfitOnSalesRatio());
		map.put(GROSS_PROFIT_MARGIN_RATIO, new GrossProfitMarginRatio());
		map.put(RETURN_ON_ASSETS_RATIO, new ReturnOnAssetsRatio());
		map.put(RETURN_ON_EQUITY_RATIO, new ReturnOnEquityRatio());
		map.put(EARNINGS_PER_SHARE, new EarningsPerShare());
		
		return map;
	}
	
	
	public static List<Equation> equationNamesListToEquationsList(List<String> equationNames)
	{
		List<Equation> equationList = new ArrayList<Equation>();
		Map<String, Equation> equationMap = getEquationMap();
		
		for( String equationName: equationNames )
		{
			equationList.add( equationMap.get(equationName));
		}
		return equationList;
	}
	
}
